package com.commodity.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class FormatMatch {
    public static boolean validatePhoneNumber(String phoneNumber) {
        String regex = "^1[3456789]\\d{9}$"; // 以1开头，第二位是3、4、5、6、7、8、9，后面跟11位数字，最后以6位数字结尾
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(phoneNumber);
        return matcher.matches();
    }
    public static boolean isInteger(String str) {
        return str.matches("-?\\d+");
    }
    public static boolean isFloatNumber(String input) {
        String regex = "^\\d+(\\.\\d+)?$";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(input);
        return matcher.matches();
    }

}
